﻿using System;
using Microsoft.Extensions.Configuration;
using System.Collections.Generic;

namespace CommandLineSample
{
    class Program
    {
        static void Main(string[] args)
        {
            //设置默认参数值
            var strings = new Dictionary<string, string>()
            {
                { "name","chenchao" },
                { "age","15" }
                };

            var bulider = new ConfigurationBuilder()
                .AddInMemoryCollection(strings)     //设置默认值 内存添加
                .AddCommandLine(args); //设置输入参数

            var configuration = bulider.Build();

            Console.WriteLine($"NAME:{configuration["name"]}");
            Console.WriteLine($"AGE:{configuration["age"]}");

            Console.ReadLine();
        }
    }
}
